//
//  UINavigationController+Push.m
//  高仿暴走斗图
//
//  Created by key on 16/3/21.
//  Copyright © 2016年 huangsongyao. All rights reserved.
//

#import "UINavigationController+Push.h"
#import "UIImage+Canvas.h"
#import "HSYBaseCardNavigationController+Animation.h"

@implementation UINavigationController (Push)

#pragma mark - Push

- (void)customPushViewController:(UIViewController *)viewController withCustomTransitions:(kHSYCustomViewAnimationTransitionType)transitions subtype:(NSString *)subtype completion:(void (^)())completion {
    
    @weakify(self);
    switch (transitions) {
        case kHSYCustomViewAnimationTransitionTypeNone:{
            [self standardAnimationWithController:viewController duration:[self animationDuration] options:UIViewAnimationOptionTransitionNone
                                     changesCompletion:^{
                                         @strongify(self);
                                         [self pushViewController:viewController animated:NO];
                                     }];
        }
            break;
            
        case kHSYCustomViewAnimationTransitionTypeFlipFromLeft:{
            [self standardAnimationWithController:viewController duration:[self animationDuration] options:UIViewAnimationOptionTransitionFlipFromLeft
                                     changesCompletion:^{
                                         @strongify(self);
                                         [self pushViewController:viewController animated:NO];
                                     }];
        }
            break;
            
        case kHSYCustomViewAnimationTransitionTypeFlipFromRight:{
            [self standardAnimationWithController:viewController duration:[self animationDuration] options:UIViewAnimationOptionTransitionFlipFromRight
                                     changesCompletion:^{
                                         @strongify(self);
                                         [self pushViewController:viewController animated:NO];
                                     }];
        }
            break;
            
        case kHSYCustomViewAnimationTransitionTypeCurlUp:{
            [self standardAnimationWithController:viewController duration:[self animationDuration] options:UIViewAnimationOptionTransitionCurlUp
                                     changesCompletion:^{
                                         @strongify(self);
                                         [self pushViewController:viewController animated:NO];
                                     }];
        }
            break;
            
        case kHSYCustomViewAnimationTransitionTypeCurlDown:{
            [self standardAnimationWithController:viewController duration:[self animationDuration] options:UIViewAnimationOptionTransitionCurlDown
                                     changesCompletion:^{
                                         @strongify(self);
                                         [self pushViewController:viewController animated:NO];
                                     }];
        }
            break;
        case kHSYCustomViewAnimationTransitionTypeFadeIn:{
            [self coreAnimationWithController:viewController duration:[self animationDuration] type:kCATransitionFade subtype:subtype
                                 changesCompletion:^{
                                     @strongify(self);
                                     [self pushViewController:viewController animated:NO];
                                 }];
        }
            break;
            
        case kHSYCustomViewAnimationTransitionTypeMoveIn:{
            [self coreAnimationWithController:viewController duration:[self animationDuration] type:kCATransitionMoveIn subtype:subtype
                                 changesCompletion:^{
                                     @strongify(self);
                                     [self pushViewController:viewController animated:NO];
                                 }];
        }
            break;
            
        case kHSYCustomViewAnimationTransitionTypePush:{
            [self coreAnimationWithController:viewController duration:[self animationDuration] type:kCATransitionPush subtype:subtype
                                 changesCompletion:^{
                                     @strongify(self);
                                     [self pushViewController:viewController animated:NO];
                                 }];
        }
            break;
            
        case kHSYCustomViewAnimationTransitionTypeReveal:{
            [self coreAnimationWithController:viewController duration:[self animationDuration] type:kCATransitionReveal subtype:subtype
                                 changesCompletion:^{
                                     @strongify(self);
                                     [self pushViewController:viewController animated:NO];
                                 }];
        }
            break;
            
        default:
            break;
    }
    
    completion();
}



@end
